package org.zebra.satoken.security;

import cn.dev33.satoken.stp.StpInterface;

import java.util.List;
import java.util.function.Supplier;

/**
 * @author zhanghongbin
 */
public class SaTokenPermission implements StpInterface {

    private Supplier<List<String>> permissionListSupplier;
    private Supplier<List<String>> roleListSupplier;

    public SaTokenPermission(Supplier<List<String>> permissionListSupplier, Supplier<List<String>> roleListSupplier) {
        this.permissionListSupplier = permissionListSupplier;
        this.roleListSupplier = roleListSupplier;
    }

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return this.permissionListSupplier.get();
    }

    /**
     * 获取角色权限列表
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return this.roleListSupplier.get();
    }
}
